﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.生产计划.生产计划.service
{
    public class 生产计划Service
    {
        public static List<DTO未排产客户> get未排产客户一览(String shopId)
        {
            return
                FunctionHelper.JsonDeserialization<List<DTO未排产客户>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/pmc/findNotScheduledCustomersByShopId?shopId=" + shopId
                        )
                    );
        }
        public static List<DTO客户下款式订单> get客户下款式订单(String customerId)
        {
            return
                FunctionHelper.JsonDeserialization<List<DTO客户下款式订单>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/pmc/findAllStyleByCustomerId?customerId=" + customerId
                        )
                    );
        }
        
    }

    public class DTO未排产客户
    {
        public String customerId { get; set; }
        public String customerName { get; set; }
        public String mobile { get; set; }
        public Double quantity { get; set; }
        public DTO未排产客户()
        {

        }
    }
    public class DTO客户下款式订单  //客户下的订单根据款式汇总
    {
        public String shopId { get; set; }
        public String refStyleId { get; set; }
        public String styleNameCn { get; set; }
        public String quantity { get; set; }
        public String status { get; set; }
        public List<DTO款式下订单> orderCommitOverviewDtos { get; set; }
        public DTO客户下款式订单()
        {

        }
    }
    public class DTO款式下订单  //款式下的订单信息
    {
        public String customerId { get; set; }
        public String customerName { get; set; }
        public String mobile { get; set; }
        public DateTime orderDate { get; set; }
        public String orderId { get; set; }
        public String orderNo { get; set; }
        public Double orderNumber { get; set; }
        public String refStyleId { get; set; }
        public String shopId { get; set; }
        public String shopName { get; set; }
        public String styleNameCn { get; set; }
        public String styleSizeCd { get; set; }
        public String wipStatus { get; set; }  //生产状态
        public DTO款式下订单()
        {

        }
    }
    #region  DTO客户下款式订单的页面显示的转换操作
    public class DTO客户下款式订单显示  //客户下的订单根据款式汇总页面显示
    {
        public String shopId { get; set; }
        public String refStyleId { get; set; }
        public String styleNameCn { get; set; }
        public String quantity { get; set; }
        public String status { get; set; }
        public List<DTO款式下订单显示> 款式下订单 { get; set; } = new List<DTO款式下订单显示>();
        public DTO客户下款式订单显示(DTO客户下款式订单 DTO客户下款式订单)
        {
            this.shopId = DTO客户下款式订单.shopId;
            this.refStyleId = DTO客户下款式订单.refStyleId;
            this.styleNameCn = DTO客户下款式订单.styleNameCn;
            this.quantity = DTO客户下款式订单.quantity;
            this.status = DTO客户下款式订单.status;
            foreach (DTO款式下订单 item in DTO客户下款式订单.orderCommitOverviewDtos)
            {
                this.款式下订单.Add(new DTO款式下订单显示(item));
            }
        }
    }
    public class DTO款式下订单显示  //款式下的订单信息页面显示
    {
        public String 客户ID { get; set; }
        public String 客户名 { get; set; }
        public String 电话 { get; set; }
        public DateTime 订单时间 { get; set; }
        public String 订单ID { get; set; }
        public String 订单号 { get; set; }
        public Double 订单数量 { get; set; }
        public String 款式ID { get; set; }
        public String 店铺ID { get; set; }
        public String 店铺名 { get; set; }
        public String 款式 { get; set; }
        public String 尺码 { get; set; }
        public String 生产状态 { get; set; }  //生产状态
        public DTO款式下订单显示(DTO款式下订单 dTO)
        {
            this.客户ID = dTO.customerId;
            this.客户名 = dTO.customerName;
            this.电话 = dTO.mobile;
            this.订单时间 = dTO.orderDate;
            this.订单ID = dTO.orderId;
            this.订单号 = dTO.orderNo;
            this.订单数量 = dTO.orderNumber;
            this.款式ID = dTO.refStyleId;
            this.店铺ID = dTO.shopId;
            this.店铺名 = dTO.shopName;
            this.款式 = dTO.styleNameCn;
            this.尺码 = dTO.styleSizeCd;
            this.生产状态 = dTO.wipStatus;
        }
    }
    #endregion

    public class Const生产状态
    {
        public const String NOT_SCHEDULED = "未排产";
        public const String SCHEDULED = "已排产";
        public const String WIP = "已投产";
        public const String PARTIAL_WIP = "部分投产";
        public const String STOCK_IN = "已入库";
        public const String PARTIAL_STOCK_IN = "部分入库";
        public const String TRANSIT = "在途";
        public const String PARTIAL_TRANSIT = "部分在途";
        public const String COMPLETE = "完成";
    }

}
